<?php
	$configFile = ".". DIRECTORY_SEPARATOR . "install" . DIRECTORY_SEPARATOR . "config.txt";

	require "." . DIRECTORY_SEPARATOR . "." . DIRECTORY_SEPARATOR . "isLoggedIn.php";
	require "." . DIRECTORY_SEPARATOR . "config.php";
	require "." . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "LEO.php";
	require "." . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "LEO_RECHT.php";
	require "." . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "Security.php";
	require "." . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "RECHT.php";
	require "." . DIRECTORY_SEPARATOR . "Slim" . DIRECTORY_SEPARATOR . "Middleware.php";
	require "." . DIRECTORY_SEPARATOR . "Slim" . DIRECTORY_SEPARATOR . "Slim.php";
	require "." . DIRECTORY_SEPARATOR . "NotORM.php";
	require "." . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "JsonMiddleware.php";
	
	Config::resetConfig($configFile);
	
	\Slim\Slim::registerAutoloader();
	
	$strDbLocation = "mysql:dbname=" . Config::$MYSQL_DATENBANK . ";host=" . Config::$MYSQL_HOST . ";charset=utf8";
	$strDbUser = Config::$MYSQL_BENUTZER;
	$strDbPassword = Config::$MYSQL_KENNWORT;
	
	$pdo = new PDO($strDbLocation, $strDbUser, $strDbPassword);
	$db = new NotORM($pdo);
	
	
	$app = new \Slim\Slim();
	$app->contentType('text/html; charset=utf-8');
	
	$app->add(new JsonMiddleware());
	
	include 'services/LeoServices.php';
	include 'services/RechteServices.php';
	
	$app->run();
?>